package cn.itcast.web.controller;

import cn.itcast.domain.Orders;
import cn.itcast.service.OrdersService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * @author :HCH
 * @version : 1.0.0
 * @date :Created in 2019/7/10 16:39
 * @description :TODO
 * @modified :
 */
@Controller
@RequestMapping("/orders")
@Slf4j
public class OrdersController {

    @Autowired
    private OrdersService ordersService;

    private static ModelAndView mv;

    @RequestMapping("/findAll.do")
    public ModelAndView findAll() {

        List<Orders> ordersList = ordersService.findAll();
        mv = new ModelAndView("orders-list");
        mv.addObject("ordersList", ordersList);

        return mv;
    }






}
